<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 创建一个包含30个从2开始的偶数的数组
        var numbers = [];
        for (var i = 0; i < 30; i++) {
            numbers.push(2 + 2 * i);
        }

        // 计算每5个数的平均值，并存储到另一个数组中
        var averages = [];
        for (var i = 0; i < numbers.length; i += 5) {
            var chunk = numbers.slice(i, i + 5); // 获取当前5个数的子数组
            var sum = chunk.reduce(function(acc, num) {
                return acc + num;
            }, 0);
            var avg = sum / chunk.length;
            averages.push(avg);
        }

        // 输出结果
        console.log("原数组：", numbers);
        console.log("每5个数的平均值：", averages);
    </script>
</body>
</html>
